package Server;

import static java.lang.System.exit;
import java.rmi.*;
import java.rmi.registry.*;
import javax.swing.JOptionPane;

public class Server {

    ServerImp si;

    public Server() throws RemoteException {

        try {
            si = new ServerImp();
            Registry r = LocateRegistry.createRegistry(7777);
            r.rebind("ChatServer", si);
            new ServerGUI(si, r).setVisible(true);

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "server working ....");
            exit(0);
            ex.printStackTrace();

        }
    }

    public static void main(String[] args) {

        try {
            new Server();
        } catch (RemoteException ex) {
            ex.printStackTrace();
        }
    }
}
